<!doctype html>
<html lang="en-US">
  <head>
    <link href="/assets/index.css" rel="stylesheet" type="text/css" />
    <script crossorigin="anonymous" src="https://unpkg.com/@babel/standalone@7.8.7/babel.min.js"></script>
    <script crossorigin="anonymous" src="https://unpkg.com/react@16.8.6/umd/react.production.min.js"></script>
    <script crossorigin="anonymous" src="https://unpkg.com/react-dom@16.8.6/umd/react-dom.production.min.js"></script>
    <script crossorigin="anonymous" src="/test-harness.js"></script>
    <script crossorigin="anonymous" src="/test-page-object.js"></script>
    <script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
    <script crossorigin="anonymous" src="/__dist__/botframework-webchat-fluent-theme.production.min.js"></script>
  </head>

  <body>
    <main id="webchat"></main>
    <script type="text/babel">
      run(async function () {
        const {
          React,
          ReactDOM: { render },
          WebChat: { FluentThemeProvider, ReactWebChat }
        } = window; // Imports in UMD fashion.

        const { directLine, store } = testHelpers.createDirectLineEmulator();

        const App = () => <ReactWebChat directLine={directLine} store={store} />;

        render(
          <FluentThemeProvider>
            <App />
          </FluentThemeProvider>,
          document.getElementById('webchat')
        );

        await pageConditions.uiConnected();

        await directLine.emulateIncomingActivity({
          entities: [
            {
              '@context': 'https://schema.org',
              '@id': '',
              '@type': 'Message',
              keywords: ['PreChatMessage'],
              type: 'https://schema.org/Message',
              author: {
                '@context': 'https://schema.org',
                '@type': 'Person',
                type: 'https://schema.org/Person',
                description: 'Ready to explore? Select one of the suggestions below to get started...',
                name: 'Onboarding Buddy',
                image: ''
              }
            }
          ],
          suggestedActions: {
            actions: [
              {
                text: 'Track new hire tasks.',
                type: 'messageBack',
                title: 'Checklist'
              },
              {
                text: 'Set up your laptop',
                type: 'messageBack',
                title: 'Equipment'
              },
              {
                text: 'Join groups and lists',
                type: 'messageBack',
                title: 'Groups'
              },
              {
                text: 'Access team boards.',
                type: 'messageBack',
                title: 'Boards'
              },
              {
                text: 'Meet your teammates.',
                type: 'messageBack',
                title: 'Connect'
              },
              {
                text: 'Browse team projects.',
                type: 'messageBack',
                title: 'Projects'
              }
            ],
            to: []
          },
          type: 'message'
        });

        await pageConditions.numActivitiesShown(1);

        await host.snapshot('local');
      });
    </script>
  </body>
</html>
